/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.beans;

import java.beans.PropertyDescriptor;

/**
 * The central interface of Spring's low-level JavaBeans infrastructure.
 * <br> 中心接口，Spring JavaBeans低级基础设施的中央接口。
 *
 * <p>Typically not used directly but rather implicitly via a
 * {@link org.springframework.beans.factory.BeanFactory} or a
 * {@link org.springframework.validation.DataBinder}.
 * <br>通常不直接使用，而是通过{@link org.springframework.beans.factory.BeanFactory}或
 * {@link org.springframework.validation.DataBinder}间接使用。
 *
 * <p>Provides operations to analyze and manipulate standard JavaBeans:
 * the ability to get and set property values (individually or in bulk),
 * get property descriptors, and query the readability/writability of properties.
 * <br>提供操作来分析并操作标准JavaBeans：获取和设置属性值（单独或批量），获取属性描述符，查询属性的可读/可写性。
 *
 * <p>This interface supports <b>nested properties</b> enabling the setting
 * of properties on subproperties to an unlimited depth.
 * <br>支持嵌套属性，启用设置子属性的属性到无限深度。
 *
 * <p>A BeanWrapper's default for the "extractOldValueForEditor" setting
 * is "false", to avoid side effects caused by getter method invocations.
 * Turn this to "true" to expose present property values to custom editors.
 * <br>BeanWrapper的默认设置"extractOldValueForEditor"为"false"，以避免getter方法调用引起的副作用。将此设置为"true"以公开自定义编辑器中的
 * 现有属性值。
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @since 13 April 2001
 * @see PropertyAccessor 用于属性 访问功能：1）获取属性值 2）设置属性值 3）获取属性描述符 4）查询属性的可读/可写性
 * @see PropertyEditorRegistry 用于属性编辑器注册：1）注册自定义编辑器 2）查找自定义编辑器
 * @see PropertyAccessorFactory#forBeanPropertyAccess 用于获取属性访问器 1）获取Bean属性访问器
 * @see org.springframework.beans.factory.BeanFactory 用于Bean工厂：1）获取bean实例 2）获取bean类型
 * @see org.springframework.validation.BeanPropertyBindingResult 用于Bean属性绑定结果：1）Bean属性绑定结果
 * @see org.springframework.validation.DataBinder#initBeanPropertyAccess()
 * @see org.springframework.beans.TypeConverter# 用于类型转换：1）类型转换
 * @see ConfigurablePropertyAccessor 可配置的属性访问器，可以配置转换服务 ConversionService，可以配置自动增长嵌套路径 autoGrowNestedPaths 和 autoGrowNestedPaths
 */
public interface BeanWrapper extends ConfigurablePropertyAccessor {

	/**
	 * Specify a limit for array and collection auto-growing.
	 * <br> 指定数组和集合自动增长限制。
	 * <p>Default is unlimited on a plain BeanWrapper.
	 * <br> 普通BeanWrapper的默认限制为无限。
	 * @since 4.1
	 */
	void setAutoGrowCollectionLimit(int autoGrowCollectionLimit);

	/**
	 * Return the limit for array and collection auto-growing.
	 * @since 4.1
	 */
	int getAutoGrowCollectionLimit();

	/**
	 * Return the bean instance wrapped by this object.
	 * <br> 返回包装在此对象中的bean实例。
	 */
	Object getWrappedInstance();

	/**
	 * Return the type of the wrapped bean instance.
	 * <br> 返回包装的bean实例的类型。
	 */
	Class<?> getWrappedClass();

	/**
	 * Obtain the PropertyDescriptors for the wrapped object
	 * (as determined by standard JavaBeans introspection).
	 * <br> 获取包装对象的PropertyDescriptors (由标准JavaBeans introspection确定)。
	 * @return the PropertyDescriptors for the wrapped object
	 * <br> 包装对象的PropertyDescriptors
	 */
	PropertyDescriptor[] getPropertyDescriptors();

	/**
	 * Obtain the property descriptor for a specific property
	 * of the wrapped object.
	 * <br> 获取包装对象的特定属性的属性描述符。
	 * @param propertyName the property to obtain the descriptor for
	 * (may be a nested path, but not an indexed/mapped property)
	 * @return the property descriptor for the specified property
	 * @throws InvalidPropertyException if there is no such property
	 */
	PropertyDescriptor getPropertyDescriptor(String propertyName) throws InvalidPropertyException;

}
